#ifndef ImplSPO_H
#define ImplSPO_H

#include "PhoneOwnerImpl.h"
#include "Observer.h"
#include "TC.h"

class ImplSPO : public PhoneOwnerImpl , public Observer{
public:
	ImplSPO(Subject * s, string n, double c) 
		: PhoneOwnerImpl( n, c ) 
	{
		number = n;
		cost = c; 
		sbj = s; 
		sbj->Attach(this); 
	}

	~ImplSPO() { 
		sbj->Detach(this); 
	} 


	void Update (Subject* ChngSubject) { 
		if (ChngSubject == sbj ) {
			if (cost != ((TC*)ChngSubject)->getStatCost()) {
				cost = ((TC*)ChngSubject)->getStatCost();
				cout << "Stationary cost changed: " << cost << endl;
			} 
		}
	} 

	bool getState() {
		return false;  // for upgrade notifier 
	}

	virtual void printOut() { 
		cout << "Stationary Owner Number is:" << n << " and it's cost is: " << c << endl; 
	}

private:
	double cost; // phone cost
	string number; // phone number
};

#endif
